
import Tkinter as tk

class DefaultDialog(tk.Toplevel):

    def __init__(self, parent):
        tk.Toplevel.__init__(self, parent)
        self.parent = parent
        
#        self.configure(borderwidth=5)
        
        # Setup position
        self.geometry(
            "+%d+%d" % (parent.winfo_rootx()+20, parent.winfo_rooty()+30)
        )

#        self.resizable(height=tk.FALSE,width=tk.FALSE)

        self.transient(parent)
        self.grab_set()
        self.focus_set()
        
        self.protocol("WM_DELETE_WINDOW", self.cancel)

        # key bindings for this dialog
        self.bind('<Escape>', self.cancel)
        self.bind('<F1>',self.Help)      

        self.setup_widgets()
        
        self.wait_window()
        
    def setup_widgets(self):
        tk.Label(self, text="The DefaultDialog test").pack()
        
    def cancel(self, event=None):
        self.destroy()

    def Ok(self):
        self.Apply()
        self.destroy()

    def Help(self):
        pass

if __name__ == '__main__':
    #test the dialog
    root=tk.Tk()
    tk.Button(
        root, text='start Dialog', command=lambda:DefaultDialog(root)
    ).pack()
    root.mainloop()